package com.bupt.secret.dto;

import com.sun.jna.Structure;
import lombok.Data;

import java.util.Arrays;
import java.util.List;

@Data
public class CipherRSArefPrivateKey extends Structure {

    //私钥密文，PKCS#5填充，ECB加密
    public byte[] cipherKey = new byte[1424];
    //私钥明文SHA256摘要值
    public byte[] keyHashSHA256 = new byte[32];
    //保密密钥算法标识，支持AES，可选支持SM4
    public int secretKeyAlgID;
    //盐，用于计算保密密钥，计算方法：secertKey = SHA256( PIN || salt ) 取前16字节
    public byte[] salt = new byte[32];

    @Override
    protected List<String> getFieldOrder() {
        return Arrays.asList(
                "cipherKey", "keyHashSHA256", "secretKeyAlgID",
                "salt"
        );
    }
}